package com.opener.common.code.assistant.gen;

import com.opener.common.code.assistant.model.Tab;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

public class Ctx {
    private Map<String,MvcClass> mvcClasses = new HashMap<>();
    public void addMvcClass(String key, MvcClass cls){
        mvcClasses.put(key, cls);
    }

    public Map<String, MvcClass> getMvcClasses() {
        return mvcClasses;
    }
    public MvcClass getMvcClass(String key){
        return mvcClasses.get(key);
    }

    public static class MvcClass{
        private String pkg;
        private Tab tab;
        private String className;
        private File classFile;
        private Generator generator;
        public MvcClass(){}
        public MvcClass(String pkg,Tab tab,String className, File classFile){
            this.pkg = pkg;
            this.tab = tab;
            this.className = className;
            this.classFile = classFile;
        }
        public String getModName(){
            String[]  a = pkg.split("\\.");
            return a[a.length-1];
        }

        public String getPkg() {
            return pkg;
        }

        public void setPkg(String pkg) {
            this.pkg = pkg;
        }

        public Tab getTab() {
            return tab;
        }

        public void setTab(Tab tab) {
            this.tab = tab;
        }

        public String getClassName() {
            return className;
        }

        public void setClassName(String className) {
            this.className = className;
        }

        public File getClassFile() {
            return classFile;
        }

        public void setClassFile(File classFile) {
            this.classFile = classFile;
        }

        public Generator getGenerator() {
            return generator;
        }

        public void setGenerator(Generator generator) {
            this.generator = generator;
        }
    }
}
